package com.itheima.mapper;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Mapper
public interface OrdersettingMapper {
    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    void updateNumberByOrderDate(OrderSetting orderSetting);

    /**
     * 根据两个时间查询中间时间的预约设置信息
     * @param firstDayOfMonth
     * @param lastDayOfMonth
     * @return
     */
    @Select("select * from t_ordersetting where orderDate between #{firstDayOfMonth} and #{lastDayOfMonth}")
    List<OrderSetting> getOrderSettingByMonth(LocalDate firstDayOfMonth, LocalDate lastDayOfMonth);

    void deleteByDates(List<Date> dates);

    void batchInsert(List<OrderSetting> settings);
}
